﻿@{
    Layout = null;

}

<script type="text/javascript">
    var modulewidth = @((ViewBag.FunctionList.Count+1) * 90) + 30;
</script>
<div id="containermodule" style="overflow-x:auto;">
    <div id="module">
        @foreach (LineOfBusiness.Poco.SYS_FunctionList func in ViewBag.FunctionList)
        {
            <div class="moduleitem" id="@func.Module">
                <img width="32px" height="32px" src="@Url.Content("~/Content/default/")@func.SmallIcon.Replace(@"\\", @"/")" style="border:0px;margin-top:10px;margin-left:20px" alt="@func.CustomName" />
                <span class="moduleitemtext">@func.CustomName</span>
            </div>
        }
    </div>
</div>
<script type="text/javascript">
    $(window).resize(function () { resizemodule(); });
    $(document).ready(function () {
        $("#module").width(modulewidth);
        resizemodule();

        if ($.getUrlVar("module")) {

            $("#" + $.getUrlVar("module")).css("background-color", "#d8571f");
        }
        else if (moduleID != "") {
            $("#" + moduleID).css("background-color", "#d8571f");
        }
        else {
            $("#AD").css("background-color", "#d8571f");
        }
        $(".moduleitem").click(function () {
            document.location.href = "@Url.Action("Metro","Home")?module=" + this.id;

            $.cookie("lastmodule", this.id, { expires: 356 });
        });

        $("#containermodule").on("mousewheel", function (event, delta, deltaX, deltaY) {
            $('#containermodule').scrollLeft($('#containermodule').scrollLeft() + delta*50);
        });

    });

    function resizemodule()
    {
        $("#containermodule").width($(window).width() - 20);

    }
</script>